﻿Imports System.Data
Imports VSModel
Imports Cls_Common

Partial Class Control_Store_Detail
    Inherits System.Web.UI.UserControl
#Region "Sub and Function "
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            If Not Request.QueryString("Storeid").ToString.Equals("0") Then
                hidID.Value = Request.QueryString("Storeid")
                ShowData()
            End If
        End If
    End Sub
    Protected Sub ShowData()
        Using data As New VSEntities
            Dim p As Store = (From q In Data.Stores Where q.StoreId = hidID.Value Select q).SingleOrDefault
            If Not p Is Nothing Then
                lblTitle.Text = IIf(IsNothing(p.Title) = True, "", p.Title)
                lblDescription.Text = IIf(IsNothing(p.Description) = True, "", p.Description)
                lblUrlweb.Text = IIf(IsNothing(p.URLWEB) = True, "", p.URLWEB)
                lblEmail.Text = IIf(IsNothing(p.Email) = True, "", p.Email)
                lblImglogo.ImageUrl = IIf(IsNothing(p.ImgLogo) = True, "", p.ImgLogo)
                If Not p.UserId Is Nothing Then
                    Dim t = (From h In data.Users Where h.UserId = p.UserId Select h).FirstOrDefault
                    If Not t Is Nothing Then
                        lblUserid.Text = t.UserName
                    End If
                End If
                lblBeffectivedate.Text = IIf(IsNothing(p.bEffectiveDate) = True, "", Convert.ToDateTime(p.bEffectiveDate).ToString("dd/MM/yyyy"))
                lblPublisheddate.Text = IIf(IsNothing(p.PublishedDate) = True, "", Convert.ToDateTime(p.PublishedDate).ToString("dd/MM/yyyy"))
                lblEeffectivedate.Text = IIf(IsNothing(p.eEffectiveDate) = True, "", Convert.ToDateTime(p.eEffectiveDate).ToString("dd/MM/yyyy"))
                lblSkypeid.Text = IIf(IsNothing(p.SkypeId) = True, "", p.SkypeId)
                lblSlogan.Text = IIf(IsNothing(p.Slogan) = True, "", p.Slogan)
                lblYahooid.Text = IIf(IsNothing(p.YahooId) = True, "", p.YahooId)

                ' lblContactus.Text = IIf(IsNothing(p.ContactUs) = True, "", p.ContactUs)
                '   lblQuerystring.Text = IIf(IsNothing(p.QueryString) = True, "", p.QueryString)
                'If Not p.ModifierId Is Nothing Then
                '    Dim t = (From h In data.Users Where h.UserId = p.ModifierId Select h).FirstOrDefault
                '    If Not t Is Nothing Then
                '        lblModifierid.Text = t.UserName
                '    End If
                'End If
                '  lblViewed.Text = IIf(IsNothing(p.Viewed) = True, "", p.Viewed)
                ' lblMark.Text = IIf(IsNothing(p.Mark) = True, "", p.Mark)
                ' lblTotalvote.Text = IIf(IsNothing(p.TotalVote) = True, "", p.TotalVote)

                '  lblIshot.Checked = IIf(IsNothing(p.IsHot) = True, False, p.IsHot)
                '  lblStatusid.Text = IIf(IsNothing(p.StatusId) = True, "", p.Status.Title)
            End If
        End Using
    End Sub
#End Region
End Class
